package Atest;

/**
 * @Author wangzhipeng
 * @Date 2020-08-26 2:08 下午
 * @Description
 */


class Foo{
    public int a;
    public Foo(){
        a = 3;
        System.out.println("a=3");
    }
    public void addFive(){
        a+=5;
        System.out.println("1:a+5");
    }
}
class Bar extends Foo{
    public int a;
    public int b= 8;
    public Bar(){
        a = 8;
        System.out.println("a=8");
    }
    public void addFive(){
        a+=5;
        System.out.println("2:a+5");
    }
}
public class TestFoo {
    public static void main(String[] args) {
        Foo foo = new Bar();
        System.out.println(foo.a);
        foo.addFive();
        System.out.println(foo.a);

    }
}
